import request from '@/utils/request'

export function getRecommendPagedList(query) {
  return request({
    url: `/api/business/recommends_admin/`,
    method: 'get',
    params: query
  })
}

export function getRecommendForEdit(id) {
  return request({
    url: `/api/business/recommends_admin/${id}/`,
    method: 'get'
  })
}

export function createRecommend(data) {
  return request({
    url: `/api/business/recommends_admin/`,
    method: 'post',
    data
  })
}

export function updateRecommend(id, data) {
  return request({
    url: `/api/business/recommends_admin/${id}/`,
    method: 'put',
    data
  })
}

export function deleteRecommend(id) {
  return request({
    url: `/api/business/recommends_admin/${id}/`,
    method: 'delete'
  })
}

export function getRecommendItemPagedList(query) {
  return request({
    url: `/api/business/recommends_admin/items/`,
    method: 'get',
    params: query
  })
}

export function getRecommendItemForEdit(id) {
  return request({
    url: `/api/business/recommends_admin/items/${id}/`,
    method: 'get'
  })
}

export function createRecommendItem(data) {
  return request({
    url: `/api/business/recommends_admin/items/`,
    method: 'post',
    data
  })
}

export function updateRecommendItem(id, data) {
  return request({
    url: `/api/business/recommends_admin/items/${id}/`,
    method: 'put',
    data
  })
}

export function deleteRecommendItem(id) {
  return request({
    url: `/api/business/recommends_admin/items/${id}/`,
    method: 'delete'
  })
}

export function publishRecommendItems(data) { // 批量发布 取消发布
  return request({
    url: `/api/business/recommends_admin/items/publish`,
    method: 'post',
    data
  })
}

export function getRecommendList(query) {
  return request({
    url: `/api/business/recommends/`,
    method: 'get'
  })
}

export function getRecommendsByItemId(itemType, itemId) {
  return request({
    url: `/api/business/recommends/by-itemid/${itemId}/`,
    method: 'get',
    params: { item_type: itemType }
  })
}

export function getServiceCenterPagedList(query) {
  return request({
    url: `/api/service_center/articles_admin/`,
    method: 'get',
    params: query
  })
}

export function getServiceCenterForEdit(id) {
  return request({
    url: `/api/service_center/articles_admin/${id}/`,
    method: 'get'
  })
}

export function createServiceCenter(data) {
  return request({
    url: `/api/service_center/articles_admin/`,
    method: 'post',
    data
  })
}

export function updateServiceCenter(id, data) {
  return request({
    url: `/api/service_center/articles_admin/${id}/`,
    method: 'put',
    data
  })
}

export function deleteServiceCenterItem(id) {
  return request({
    url: `/api/service_center/articles_admin/${id}/`,
    method: 'delete'
  })
}
